package cn.com.yx.ms.service;


import cn.com.yx.ms.domain.auth.LicensesUseModel;
import cn.com.yx.ms.domain.dbmodel.AuthClientLicense;
import cn.yx.framework.configuration.ApiCode;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 应用中心接口
 */
public interface ILicenseService {

    /**
     * 获取导入最大号
     *
     * @param tableName
     * @param colName
     * @param modelName
     * @return
     */
    String getMaxNo(String tableName, String colName, String modelName);

    /**
     * 导入服务端下发的License压缩包
     *
     * @param request
     * @return
     */
    ApiCode importLicenseZip(MultipartHttpServletRequest request) throws Exception;

    /**
     * 使用License
     *
     * @param licensesUseModels
     * @return
     */
    ApiCode UseLicense(List<LicensesUseModel> licensesUseModels);

    /**
     * 更换设备编号
     *
     * @param licid
     * @param devsn
     * @return
     */
    ApiCode changeLicenseDevInfo(String licid, String devsn);

    /**
     * 解绑设备编号
     *
     * @param licid
     * @return
     */
    ApiCode clearLicenseDevInfo(String licid);

    /**
     * 导出需要续费的License集合
     *
     * @param licids
     * @param res
     */
    String exportLicenseZipInfo(List<AuthClientLicense> licids, HttpServletResponse res) throws Exception;

    void downloadExportZipInfo(String cacheId, HttpServletResponse res) throws Exception;
}